<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    console.log('---------------resolve----------------');
    var p1 =Promise.resolve(521);
    //如果传入的的参数为非promise类型的对象，则返回的结果为成功promise对象
    //如果传入的参数为promise对象，则参数的结果决定了resolve的结果
    let p2 = Promise.resolve(new Promise((resolve,reject)=>{
      resolve('ok');
    }))
    console.log(p1);
    console.log(p2);
    console.log('----------------reject----------------');
    let r2 = Promise.reject(new Promise((resolve,reject)=>{
      resolve('ok')
    }));
    console.log(r2);
  </script>
</body>
</html>